| Total Complexity | 2 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 15 | |||
| 16 | @Controller() |
||
| 17 | @UseGuards(IsAuthenticatedGuard) |
||
| 18 | export class HomeController { |
||
| 19 | constructor( |
||
| 20 | private readonly resolver: RouteNameResolver, |
||
| 21 | @Inject('IQueryBus') |
||
| 22 | private readonly queryBus: IQueryBus |
||
| 23 | ) {} |
||
| 24 | |||
| 25 | @Get('app') |
||
| 26 | @WithName('home') |
||
| 27 | @Render('pages/home.njk') |
||
| 28 | public async get() { |
||
| 29 | const pendingLeaves = await this.queryBus.execute( |
||
| 30 | new GetPendingLeaveRequestsCountQuery() |
||
| 31 | ); |
||
| 32 | |||
| 33 | return { pendingLeaves }; |
||
| 34 | } |
||
| 35 | |||
| 36 | @Get() |
||
| 37 | @WithName('index') |
||
| 38 | public index(@Res() res: Response) { |
||
| 39 | res.redirect(303, this.resolver.resolve('home')); |
||
| 40 | } |
||
| 42 |